package com.zhongwang.mms.module.half.dao;

import com.zhongwang.mms.gen.entity.HAdjustmentApply;
import com.zhongwang.mms.gen.entity.HCheckDetail;
import com.zhongwang.mms.gen.entity.HCheckPlan;
import com.zhongwang.mms.module.half.model.HAdjustmentApplyModel;
import com.zhongwang.mms.module.half.model.HCheckDetailModel;
import com.zhongwang.mms.module.half.model.HCheckPlanModel;
import com.zhongwang.mms.module.purchase.model.check.PCheckDetailExcelModel;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Description: 盘点
 */
@Repository
public interface InventoryCheckDao {

    /**
     * 根据条件查询相关盘点计划
     *
     * @param hCheckPlanModel 查询条件
     * @return list
     */
    List<HCheckPlanModel> findCheckPlan(HCheckPlanModel hCheckPlanModel);

    /**新增盘点计划*/
    int insertCheckPlanSelective(HCheckPlan hCheckPlan);

    /**根据主键修改盘点计划*/
    int updateCheckPlanByPrimaryKeySelective(HCheckPlan hCheckPlan);
    /**
     * 删除变更记录表（update变更记录表status为0）
     * @param hCheckPlanModel
     */
    void deleteCheckPlanRecordById(HCheckPlanModel hCheckPlanModel);

    /**根据主键获取盘点计划*/
    HCheckPlanModel getHCheckPlanByByPrimaryKey(Integer cpnId);

    /**获取最后编码*/
    String findLastIPCOrderCode();

    /**根据盘点计划编码获取盘点明细列表*/
    List<HCheckDetailModel> findDetailList(HCheckDetailModel hCheckDetailModel);

    /**根据计划编号获取计划*/
    HCheckPlanModel getHCheckPlanByByCpnCode(String cpnCode);

    /**新增盘点明细数据*/
    int insertCheckDetailSelective(HCheckDetailModel hCheckDetailModel1);

    /**根据计划主键获取计划明细*/
    List<HCheckDetailModel> findDetailListByCdlCpnId(Integer cdlCpnId);

    /**盘点结果列表*/
    List<HCheckDetailModel> findResultList(HCheckDetailModel hCheckDetailModel);

    /**根据主键获取盘点明细数据*/
    HCheckDetailModel getHCheckDetailByPrimaryKey(Integer cdlId);

    /**根据主键修改盘点明细*/
    int updateHCheckDetailByPrimaryKeySelective(HCheckDetail record);

    /**添加库存调整*/
    int insertAdjustmentApplySelective(HAdjustmentApply record);

    /**根据盘点计划ID删除损益调整表数据*/
    int deleteHAdjustmentApplyByAjaCpnId(Integer cdlCpnId);

    /**获得盘点损益表列表*/
    List<HAdjustmentApplyModel> selectHAdjustmentApplyModelSelectiveByCdlCpnId(HAdjustmentApplyModel param);

    /**获得汇总表信息*/
    List<HAdjustmentApplyModel> palSumList(HAdjustmentApplyModel param);

    /**根据主键获取损益列表*/
    List<HAdjustmentApplyModel> selectHAdjustmentApplyModelSelectiveByPrimaryKeys(String ajaIds);

    /**根据主键更改申请状态*/
    int updateHAdjustmentApplyModelAjaItyStatus(HAdjustmentApplyModel updateItyStatusModel);

    /**根据计划好获取盘点结果中状态为盘点的数据数量*/
    Integer getCheckDetailCheckCountByCdlCpnId(Integer cpnId);

    /**批量删除盘点明细*/
    int deleteCheckDetailByPrimaryKeys(String cdlIds);

    /**根据计划主键获取盘点明细数量*/
    int getCheckDetailCountByCdlCpnId(Integer cdlCpnId);

    /**根据主键导出盘点计划（导出盘点明细）*/
    List<PCheckDetailExcelModel> findHCheckPlanByPrimaryKey(Integer cpnId);

    /**根据主键删除盘点明细*/
    void deleteCheckDetailByPrimaryKey(Integer cdlId);

    /**清空该计划的盘点结果*/
    void resultClean(Integer cdlCpnId);

    /**根据主键更新盘点数量和状态*/
    void updateHCheckDetailCdlNumAndCdlStatus(PCheckDetailExcelModel data);
}